/**
 * 
 */
package verda.kvantumo.Itala_Esperanta_Vortaro;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.widget.EditText;

/**
 * @author kvantumo
 *
 */
public class Gramatikero extends Activity{
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gramatikero);
        
        Bundle extras = getIntent().getExtras();
        int rawGramatikero = extras.getInt("gramatikero");
        setTitle(extras.getString("nomo"));
        
        EditText teksto = (EditText) findViewById(R.id.editText_teksto_gramatikero);
        teksto.setText(Html.fromHtml(sxargxasGramatikeron(rawGramatikero)));
	}
	
	public String sxargxasGramatikeron(int id){
		String rez = "";
		try
		   {
			   BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(id)));
			   String temp;
			   while((temp = in.readLine()) != null){
				   rez += temp;
			   }
		   }
		   catch (FileNotFoundException e) {
			   e.printStackTrace();
		   }
		   catch (IOException ioe) {
			   ioe.printStackTrace();
		   }
		   return rez;
	}
}
